package pri.jz.keeper.ui.view

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.material.Icon
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.colorResource
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import pri.jz.keeper.R
import pri.jz.keeper.util.NetworkUtil.networkState

/**
 *Author by: JZ
 *Email: 2451756617@qq.com
 *PS:网络丢失提示框
 */
@Composable
fun NetworkLostSheet(
    modifier: Modifier = Modifier
) {
    if (networkState?.value == -1) {
        Row(
            modifier = modifier.fillMaxWidth()
                .height(45.dp)
                .background(colorResource(R.color.light_pink)),
            verticalAlignment = Alignment.CenterVertically
        ) {
            Icon(
                painter = painterResource(R.drawable.img_warning),
                contentDescription = null,
                tint = Color.Unspecified,
                modifier = Modifier.padding(horizontal = 25.dp).size(20.dp)
            )
            Text(
                text = "网络不给力，请检查网络设置。",
                color = Color.Red
            )
        }
    }
}